<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0 ,minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">

		<title>结算页面</title>

		<link href="/Public/one/AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet" type="text/css" />

		<link href="/Public/one/basic/css/demo.css" rel="stylesheet" type="text/css" />
		<link href="/Public/one/css/cartstyle.css" rel="stylesheet" type="text/css" />

		<link href="/Public/one/css/jsstyle.css" rel="stylesheet" type="text/css" />

		<script type="text/javascript" src="/Public/one/js/address.js"></script>

	</head>

	<body>

		<!--顶部导航条 -->
		<div class="am-container header">
				<ul class="message-l">
					<div class="topMessage">
						<div class="menu-hd">
							<?php if($_SESSION['uname'] != false ): ?><a href="#" target="_top" class="h">亲，<?php echo ($_SESSION['uname']); ?></a>
								<a href="/Home/Index/out" target="_top">退出</a>

							<?php else: ?>
								<a href="/Home/Login/index" target="_top" class="h">亲，请登录</a>
								<a href="/Home/Register/index" target="_top">免费注册</a><?php endif; ?>
							
						</div>
					</div>
				</ul>
				<ul class="message-r">
					<div class="topMessage home">
						<div class="menu-hd"><a href="/Home/Index/index" target="_top" class="h">商城首页</a></div>
					</div>
					<div class="topMessage my-shangcheng">
						<div class="menu-hd MyShangcheng"><a href="/Home/Information/index" target="_top"><i class="am-icon-user am-icon-fw"></i>个人中心</a></div>
					</div>
					<div class="topMessage mini-cart">
						<div class="menu-hd"><a id="mc-menu-hd" href="/Home/Shopcart/index" target="_top"><i class="am-icon-shopping-cart  am-icon-fw"></i><span>购物车</span><strong id="J_MiniCartNum" class="h">
						<?php if($count != false): echo ($count); ?>
						<?php else: ?>
						0<?php endif; ?>
						</strong></a></div>
					</div>
					<div class="topMessage favorite">
						<div class="menu-hd"><a href="#" target="_top"><i class="am-icon-heart am-icon-fw"></i><span>收藏夹</span></a></div>
				</ul>
			</div>

				<!--悬浮搜索框-->

				<div class="nav white">
					<!-- <div class="logo"><img src="/Public/one/images/logo.png" /></div> -->
					<div class="logoBig">
						<li><img src="/Public/one/images/logobig.png" /></li>
					</div>

					<div class="search-bar pr">
					<a name="index_none_header_sysc" href="#"></a>
					<form action="/Home/Search/index" method="get">
						<input id="searchInput" name="search" type="text" placeholder="搜索" autocomplete="off">
						<input id="ai-topsearch" class="submit am-btn"  value="搜索" index="1" type="submit">
					</form>
				</div>
				</div>

				<div class="clear"></div>
			<div class="concent">
				<!--地址 -->
				<div class="paycont">
					<div class="address">
						<h3>确认收货地址 </h3>
					
						<div class="control">
							<div class="tc-btn createAddr theme-login am-btn am-btn-danger">使用新地址</div>
						</div>
						<div class="clear"></div>
						<ul id="showAddress">
							<!-- <div class="per-border"></div>
							<li class="user-addresslist defaultAddr">

								<div class="address-left">
									<div class="user DefaultAddr">

										<span class="buy-address-detail">   
                   <span class="buy-user">艾迪 </span>
										<span class="buy-phone">15871145629</span>
										</span>
									</div>
									<div class="default-address DefaultAddr">
										<span class="buy-line-title buy-line-title-type">收货地址：</span>
										<span class="buy--address-detail">
								   <span class="province">湖北</span>省
										<span class="city">武汉</span>市
										<span class="dist">洪山</span>区
										<span class="street">雄楚大道666号(中南财经政法大学)</span>
										</span>

										</span>
									</div>
									<ins class="deftip">默认地址</ins>
								</div>
								<div class="address-right">
									<a href="/Public/one/person/address.html">
										<span class="am-icon-angle-right am-icon-lg"></span></a>
								</div>
								<div class="clear"></div>

								<div class="new-addr-btn">
									<a href="#" class="hidden">设为默认</a>
									<span class="new-addr-bar hidden">|</span>
									<a href="#">编辑</a>
									<span class="new-addr-bar">|</span>
									<a href="javascript:void(0);" onclick="delClick(this);">删除</a>
								</div>

							</li>
							<div class="per-border"></div>
							<li class="user-addresslist">
								<div class="address-left">
									<div class="user DefaultAddr">

										<span class="buy-address-detail">   
                   <span class="buy-user">艾迪 </span>
										<span class="buy-phone">15871145629</span>
										</span>
									</div>
									<div class="default-address DefaultAddr">
										<span class="buy-line-title buy-line-title-type">收货地址：</span>
										<span class="buy--address-detail">
								   <span class="province">湖北</span>省
										<span class="city">武汉</span>市
										<span class="dist">武昌</span>区
										<span class="street">东湖路75号众环大厦2栋9层902</span>
										</span>

										</span>
									</div>
									<ins class="deftip hidden">默认地址</ins>
								</div>
								<div class="address-right">
									<span class="am-icon-angle-right am-icon-lg"></span>
								</div>
								<div class="clear"></div>

								<div class="new-addr-btn">
									<a href="#">设为默认</a>
									<span class="new-addr-bar">|</span>
									<a href="#">编辑</a>
									<span class="new-addr-bar">|</span>
									<a href="javascript:void(0);"  onclick="delClick(this);">删除</a>
								</div>

							</li>
 -->
						</ul>

						<div class="clear"></div>
					</div>
					<!--物流 -->
					<div class="logistics">
						<h3>选择物流方式</h3>
						<ul class="op_express_delivery_hot">
							<li data-value="yuantong" class="OP_LOG_BTN  "><i class="c-gap-right" style="background-position:0px -468px"></i>圆通<span></span></li>
							<li data-value="shentong" class="OP_LOG_BTN  "><i class="c-gap-right" style="background-position:0px -1008px"></i>申通<span></span></li>
							<li data-value="yunda" class="OP_LOG_BTN  "><i class="c-gap-right" style="background-position:0px -576px"></i>韵达<span></span></li>
							<li data-value="zhongtong" class="OP_LOG_BTN op_express_delivery_hot_last "><i class="c-gap-right" style="background-position:0px -324px"></i>中通<span></span></li>
							<li data-value="shunfeng" class="OP_LOG_BTN  op_express_delivery_hot_bottom"><i class="c-gap-right" style="background-position:0px -180px"></i>顺丰<span></span></li>
						</ul>
					</div>
					<div class="clear"></div>

					<!--支付方式-->
					<div class="logistics">
						<h3>选择支付方式</h3>
						<ul class="pay-list">
							<li class="pay card"><img src="/Public/one/images/wangyin.jpg" />银联<span></span></li>
							<li class="pay qq"><img src="/Public/one/images/weizhifu.jpg" />微信<span></span></li>
							<li class="pay taobao"><img src="/Public/one/images/zhifubao.jpg" />支付宝<span></span></li>
						</ul>
					</div>
					<div class="clear"></div>

<!--订单 -->
<div class="concent">
	<div id="payTable">
	<h3>确认订单信息</h3>
	<div class="cart-table-th">
		<div class="wp">

			<div class="th th-item">
				<div class="td-inner">商品信息</div>
			</div>
			<div class="th th-price">
				<div class="td-inner">单价</div>
			</div>
			<div class="th th-amount">
				<div class="td-inner">数量</div>
			</div>
			<div class="th th-sum">
				<div class="td-inner">金额</div>
			</div>
			<div class="th th-oplist">
				<div class="td-inner">配送方式</div>
			</div>

		</div>
	</div>
	<div class="clear"></div>
<!-- 输出模版 -->
	<div id="list">


	</div>		
		<!-- <tr class="item-list">
			<div class="bundle  bundle-last">
				<div class="bundle-main">
					<ul class="item-content clearfix">
						<div class="pay-phone">
							<li class="td td-item">
								<div class="item-pic">
									<a href="#" class="J_MakePoint">
										<img src="/Public/one/images/kouhong.jpg_80x80.jpg" class="itempic J_ItemImg"></a>
								</div>
								<div class="item-info">
									<div class="item-basic-info">
										<a href="#" class="item-title J_MakePoint" data-point="tbcart.8.11">美康粉黛醉美唇膏 持久保湿滋润防水不掉色</a>
									</div>
								</div>
							</li>
							<li class="td td-info">
								<div class="item-props">
									<span class="sku-line">颜色：12#川南玛瑙</span>
									<span class="sku-line">包装：裸装</span>
								</div>
							</li>
							<li class="td td-price">
								<div class="item-price price-promo-promo">
									<div class="price-content">
										<em class="J_Price price-now">39.00</em>
									</div>
								</div>
							</li>
						</div>
						<li class="td td-amount">
							<div class="amount-wrapper ">
								<div class="item-amount ">
									<span class="phone-title">购买数量</span>
									<div class="sl">
										<input class="min am-btn" name="" type="button" value="-" />
										<input class="text_box" name="" type="text" value="3" style="width:30px;" />
										<input class="add am-btn" name="" type="button" value="+" />
									</div>
								</div>
							</div>
						</li>
						<li class="td td-sum">
							<div class="td-inner">
								<em tabindex="0" class="J_ItemSum number">117.00</em>
							</div>
						</li>
						<li class="td td-oplist">
							<div class="td-inner">
								<span class="phone-title">配送方式</span>
								<div class="pay-logis">
									快递<b class="sys_item_freprice">10</b>元
								</div>
							</div>
						</li>

					</ul>
					<div class="clear"></div>

				</div>
		</tr>
		<div class="clear"></div>
		</div>

		<tr id="J_BundleList_s_1911116345_1" class="item-list">
			<div id="J_Bundle_s_1911116345_1_0" class="bundle  bundle-last">
				<div class="bundle-main">
					<ul class="item-content clearfix">
						<div class="pay-phone">
							<li class="td td-item">
								<div class="item-pic">
									<a href="#" class="J_MakePoint">
										<img src="/Public/one/images/kouhong.jpg_80x80.jpg" class="itempic J_ItemImg"></a>
								</div>
								<div class="item-info">
									<div class="item-basic-info">
										<a href="#" target="_blank" title="美康粉黛醉美唇膏 持久保湿滋润防水不掉色" class="item-title J_MakePoint" data-point="tbcart.8.11">美康粉黛醉美唇膏 持久保湿滋润防水不掉色</a>
									</div>
								</div>
							</li>
							<li class="td td-info">
								<div class="item-props">
									<span class="sku-line">颜色：10#蜜橘色+17#樱花粉</span>
									<span class="sku-line">包装：两支手袋装（送彩带）</span>
								</div>
							</li>
							<li class="td td-price">
								<div class="item-price price-promo-promo">
									<div class="price-content">
										<em class="J_Price price-now">39.00</em>
									</div>
								</div>
							</li>
						</div>

						<li class="td td-amount">
							<div class="amount-wrapper ">
								<div class="item-amount ">
									<span class="phone-title">购买数量</span>
									<div class="sl">
										<input class="min am-btn" name="" type="button" value="-" />
										<input class="text_box" name="" type="text" value="3" style="width:30px;" />
										<input class="add am-btn" name="" type="button" value="+" />
									</div>
								</div>
							</div>
						</li>
						<li class="td td-sum">
							<div class="td-inner">
								<em tabindex="0" class="J_ItemSum number">117.00</em>
							</div>
						</li>
						<li class="td td-oplist">
							<div class="td-inner">
								<span class="phone-title">配送方式</span>
								<div class="pay-logis">
									包邮
								</div>
							</div>
						</li>

					</ul>
					<div class="clear"></div>

				</div>
		</tr> -->
	
	</div>
	</div>
<div class="clear"></div>
<div class="pay-total">
						<!--留言-->
							<div class="order-extra">
								<div class="order-user-info">
									<div id="holyshit257" class="memo">
										<label>买家留言：</label>
										<input type="text" title="选填,对本次交易的说明（建议填写已经和卖家达成一致的说明）" placeholder="选填,建议填写和卖家达成一致的说明" class="memo-input J_MakePoint c2c-text-default memo-close">
										<div class="msg hidden J-msg">
											<p class="error">最多输入500个字符</p>
										</div>
									</div>
								</div>

							</div>
							<!--优惠券 -->
							<div class="buy-agio">
								<li class="td td-coupon">

									<span class="coupon-title">优惠券</span>
									<select data-am-selected>
										<option value="a">
											<div class="c-price">
												<strong>￥8</strong>
											</div>
											<div class="c-limit">
												【消费满95元可用】
											</div>
										</option>
										<option value="b" selected>
											<div class="c-price">
												<strong>￥3</strong>
											</div>
											<div class="c-limit">
												【无使用门槛】
											</div>
										</option>
									</select>
								</li>

								<li class="td td-bonus">

									<span class="bonus-title">红包</span>
									<select data-am-selected>
										<option value="a">
											<div class="item-info">
												¥50.00<span>元</span>
											</div>
											<div class="item-remainderprice">
												<span>还剩</span>10.40<span>元</span>
											</div>
										</option>
										<option value="b" selected>
											<div class="item-info">
												¥50.00<span>元</span>
											</div>
											<div class="item-remainderprice">
												<span>还剩</span>50.00<span>元</span>
											</div>
										</option>
									</select>

								</li>

							</div>
							<div class="clear"></div>
							</div>
							<!--含运费小计 -->
							<div class="buy-point-discharge ">
								<p class="price g_price ">
									合计（含运费） <span>¥</span><em class="pay-sum">244.00</em>
								</p>
							</div>

							<!--信息 -->
							<div class="order-go clearfix">
								<div class="pay-confirm clearfix">
									<div class="box">
										<div tabindex="0" id="holyshit267" class="realPay"><em class="t">实付款：</em>
											<span class="price g_price ">
                                    <span>¥</span> <em class="style-large-bold-red " id="J_ActualFee">244.00</em>
											</span>
										</div>

										<div id="holyshit268" class="pay-address">
										
											<p class="buy-footer-address">
												<span class="buy-line-title buy-line-title-type">寄送至：</span>
												<span class="buy--address-detail">
								   <span class="province"></span>
												<span class="city"></span>
												<span class="dist"></span>
												<span class="street"></span>
												</span>
												</span>
											</p>
											<p class="buy-footer-address">
												<span class="buy-line-title">收货人：</span>
												<span class="buy-address-detail">   
                                         <span class="buy-user"> </span>
												<span class="buy-phone"></span>
												</span>
											</p>
										
										</div>
									</div>

									<div id="holyshit269" class="submitOrder">
										<div class="go-btn-wrap">
											<a id="J_Go"  class="btn-go" tabindex="0" onclick="pushorder()"title="点击此按钮，提交订单">提交订单</a>
										</div>
									</div>
									<div class="clear"></div>
								</div>
							</div>
						</div>

						<div class="clear"></div>
					</div>
				</div>
				<div class="footer">
					<div class="footer-hd">
						<p>
							<a href="#">恒望科技</a>
							<b>|</b>
							<a href="#">商城首页</a>
							<b>|</b>
							<a href="#">支付宝</a>
							<b>|</b>
							<a href="#">物流</a>
						</p>
					</div>
					<div class="footer-bd">
						<p>
							<a href="#">关于恒望</a>
							<a href="#">合作伙伴</a>
							<a href="#">联系我们</a>
							<a href="#">网站地图</a>
							<em>© 2015-2025 Hengwang.com 版权所有</em>
						</p>
					</div>
				</div>
			</div>
			<div class="theme-popover-mask"></div>
			<div class="theme-popover test">

				<!--标题 -->
				<div class="am-cf am-padding">
					<div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">新增地址</strong> / <small>Add address</small></div>
				</div>
				<hr/>

				<div class="am-u-md-12 ">
					<form class="am-form am-form-horizontal">

						<div class="am-form-group">
							<label for="user-name" class="am-form-label">收货人</label>
							<div class="am-form-content">
								<input type="text" id="user-name" placeholder="收货人">
							</div>
						</div>

						<div class="am-form-group">
							<label for="user-phone" class="am-form-label">手机号码</label>
							<div class="am-form-content">
								<input id="user-phone" placeholder="手机号必填" type="email">
							</div>
						</div>

						<div class="am-form-group">
							<label for="user-phone" class="am-form-label">所在地</label>
							<div class="am-form-content address">
								<select data-am-selected id="province" onchange="citySelect(this)">
									<option value="">省</option>
								</select>
								<select data-am-selected id="city"  onchange="townSelect(this)">
									<option value="">市</option>
								</select>
								<select data-am-selected id="town">
									<option value="">地方</option>
								</select>
							</div>
						</div>

						<div class="am-form-group">
							<label for="user-intro" class="am-form-label">详细地址</label>
							<div class="am-form-content">
								<textarea class="" rows="3" id="user-intro" placeholder="输入详细地址"></textarea>
								<small>100字以内写出你的详细地址...</small>
							</div>
						</div>

						<div class="am-form-group theme-poptit">
							<div class="am-u-sm-9 am-u-sm-push-3">
								<div class="am-btn am-btn-danger add" onclick="addAddress()">保存</div>
								<div class="am-btn am-btn-danger close">取消</div>
							</div>
						</div>
					</form>
				</div>

			</div>

			<div class="clear"></div>
	</body>


	<!-- 模态窗口 -->
	<div class="am-modal am-modal-no-btn" tabindex="-1" id="your-modal">
	  <div class="am-modal-dialog">
	    <div class="am-modal-hd">Modal 标题
	      <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
	    </div>
	    <div class="am-modal-bd">
	      Modal 内容。
	    </div>
	  </div>
	</div>


	<!-- 订单信息 -->
	<script type="text/html" id="order">
		
		<%for(var i=0;i<data.length;i++){%>
				
				<div class="item12">
				<div class="bundle  bundle-last">

					<div class="bundle-main">
						<ul class="item-content clearfix">
							<div class="pay-phone">
								<li class="td td-item">
									<div class="item-pic">
										<a href="#" class="J_MakePoint">
											<img src="<%=data[i].images%>" class="itempic J_ItemImg" style="width:80px;height:80px"></a>
									</div>
									<div class="item-info">
										<div class="item-basic-info">
											<a href="#" class="item-title J_MakePoint" data-point="tbcart.8.11" alt="<%=data[i].id%>"><%=data[i].name%></a>
										</div>
									</div>
								</li>
								<li class="td td-info">
									<div class="item-props">
									<%var property=data[i].property%>
									<%for(var j=0;j<property.length;j++){%>
										<span class="sku-line"><%=property[j]%></span>
										
									<%}%>
									</div>
								</li>
								<li class="td td-price">
									<div class="item-price price-promo-promo">
										<div class="price-content">
											<em class="J_Price price-now"><%=data[i].price%></em>
										</div>
									</div>
								</li>
							</div>
							<li class="td td-amount">
								<div class="amount-wrapper ">
									<div class="item-amount ">
										<span class="phone-title"><%=data[i].count%></span>
										<div class="sl">
											<input class="min am-btn" name="" type="button" value="-" onclick="reduce(this)" alt="<%=data[i].id%>"/>
											<input class="text_box" name="" type="text" value="<%=data[i].count%>" style="width:30px;" />
											<input class="add am-btn" name="" type="button" value="+" onclick="add(this)" alt="<%=data[i].id%>"/>
										</div>
									</div>
								</div>
							</li>
							<li class="td td-sum">
								<div class="td-inner">
									<em tabindex="0" class="J_ItemSum number">117.00</em>
								</div>
							</li>
							<li class="td td-oplist">
								<div class="td-inner">
									<span class="phone-title">配送方式</span>
									<div class="pay-logis">
										免运费
									</div>
								</div>
							</li>

						</ul>
						<div class="clear"></div>

					</div>
			
			<div class="clear"></div>
			</div>
			
			</div>
		<%}%>

	</script>



	<script type="text/html" id="pushAddress">
	<%for(var i=0;i<data.length;i++){%>
		<li class="user-addresslist">
			<div class="address-left">
				<div class="user DefaultAddr">

					<span class="buy-address-detail">   
					<span class="buy-user"><%=data[i].name%> </span>
					<span class="buy-phone"><%=data[i].phone%></span>
					</span>
				</div>
				<div class="default-address ">
					<span class="buy-line-title buy-line-title-type">收货地址：</span>
					<span class="buy--address-detail">
					<%var address=data[i].address%>
			   <span class="province"><%=address[0]%></span>
					<span class="city"><%=address[1]%></span>
					<span class="dist"><%=address[2]%></span>
					<span class="street"><%=address[3]%></span>
					</span>

					</span>
				</div>
				<ins class="deftip hidden">默认地址</ins>
			</div>
			<div class="address-right">
				<span class="am-icon-angle-right am-icon-lg"></span>
			</div>
			<div class="clear"></div>

			<div class="new-addr-btn">
				<a href="#">设为默认</a>
				<span class="new-addr-bar">|</span>
				<a href="#" data-am-modal="{target: '#your-modal'}">编辑</a>
				<span class="new-addr-bar">|</span>
				<a href="javascript:void(0);"  onclick="delClick(this);">删除</a>
			</div>

		</li>
	<%}%>

	</script>

	<script type="text/html" id="optionProvince">
			<%for(var i=0;i<data.length;i++){%>
				<option value="<%=data[i].id%>"><%=data[i].name%></option>
			
			<%}%>


		</script>
		<script type="text/html" id="optionCity">
			<option value="">市</option>
			<%for(var i=0;i<data.length;i++){%>
				<option value="<%=data[i].id%>"><%=data[i].name%></option>
			
			<%}%>


		</script>
		<script type="text/html" id="optionTown">
			<option value="">地方</option>
			<%for(var i=0;i<data.length;i++){%>
				<option value="<%=data[i].id%>"><%=data[i].name%></option>
			
			<%}%>


		</script>
	



	<script type="text/javascript" src="/Public/js/template-native.js"></script>

	<script type="text/javascript">
		var arrayId="<?php echo ($arrayId); ?>";
		$.get('/Api/Index/getOrData',{'id':arrayId},function(ret){
			if (ret.status==true) {
				var html=template('order',ret);
				$('#list').append(html);
				addreduce();
				singlePrice();
				totalPrice();
			}

		})
		function addreduce(){
			$(function(){
	         	$(".add").click(function(){
	         	 	var t=$(this).parent().find('input[class*=text_box]');
	         		t.val(parseInt(t.val())+1)
	       		 })
	      		$(".min").click(function(){
	       			var t=$(this).parent().find('input[class*=text_box]');
	         		t.val(parseInt(t.val())-1)
	         		if(parseInt(t.val())<1){
	         	 	t.val(1);
	         	 }
	       		})
    		}) 
		}


		function add(obj){
			var count=$(obj).closest('.item12').find('.text_box').val();
			var price=$(obj).closest('.item12').find('.J_Price').html();
			var total=(parseInt(count)+1)*parseFloat(price);
			$(obj).closest('.item12').find('.J_ItemSum').html("");
			$(obj).closest('.item12').find('.J_ItemSum').html(total.toFixed(2));
			var id=$(obj).attr('alt');
			count=count+1;
			$.post('/Api/Index/countChange',{'count':count,'id':id},function(ret){

			})
			totalPrice();
			

		}
		function reduce(obj){
			var count=$(obj).closest('.item12').find('.text_box').val();
			var price=$(obj).closest('.item12').find('.J_Price').html();
			if (count==1) {count=2}
			var total=(parseInt(count)-1)*parseFloat(price);
			$(obj).closest('.item12').find('.J_ItemSum').html("");
			$(obj).closest('.item12').find('.J_ItemSum').html(total.toFixed(2));
			var id=$(obj).attr('alt');
			count=count-1;
			$.post('/Api/Index/countChange',{'count':count,'id':id},function(ret){

			})
			totalPrice();
		}

		//初始化时算出每种商品的总价
		function singlePrice(){
			
			$('#list').find('.J_ItemSum').each(function(){
					var count=$(this).closest('.item12').find('.text_box').val();
					var price=$(this).closest('.item12').find('.J_Price').html();
					var total=parseInt(count)*parseFloat(price);
					$(this).html('');
					$(this).html(total);
			});	
		}
		//初始化时算出总额
		function totalPrice(){
			var total=0;
			$('#list').find('.J_ItemSum').each(function(){
					var price=$(this).html();
					total=parseFloat(price)+total;

			})
			$('.pay-sum').html('');
			$('.pay-sum').html(total.toFixed(2));
			$('#J_ActualFee').html('');
			$('#J_ActualFee').html(total.toFixed(2));


		}


		$.get('/Api/Index/addressSelect',{'fid':'0'},function(ret){
					if (ret.status==true) {
						var html=template('optionProvince',ret);
						$('#province').append(html);
					}
			})

			
			
		function citySelect(obj){
			var fid=$(obj).val();
			$.get('/Api/Index/addressSelect',{'fid':fid},function(ret){
					if (ret.status==true) {
						var html=template('optionCity',ret);
						$('#city').html("");
						$('#city').append(html);
					}
			})
		}
		function townSelect(obj){
			var fid=$(obj).val();
			$.get('/Api/Index/addressSelect',{'fid':fid},function(ret){
					if (ret.status==true) {
						var html=template('optionTown',ret);
						$('#town').html("");
						$('#town').append(html);
					}
			})
		}
		function addAddress(){
			
			var param={};
			 param.name=$('.am-form-horizontal').find('#user-name').val();
			 param.phone=$('.am-form-horizontal').find('#user-phone').val();
			var province=$('.am-form-horizontal').find('#province').find('option:selected').text();
			var city=$('.am-form-horizontal').find('#city').find('option:selected').text();
			var town=$('.am-form-horizontal').find('#town').find('option:selected').text();
			var detailAddress=$('.am-form-horizontal').find('#user-intro').val();
			param.address=province+";"+city+";"+town+";"+detailAddress;
			$.post('/Api/Index/clientAddress',param,function(ret){


			})

			//关闭窗口
			$('#showAddress').html("");
			getAddress();
			$(document.body).css("overflow","visible");
			$('.theme-login').removeClass("selected");
			$('.item-props-can').removeClass("selected");					
			$('.theme-popover-mask').hide();
			$('.theme-popover').slideUp(200);
		}



		//获取用户地址信息
		function getAddress(){
			$.get('/Api/Index/getAddress',null,function(ret){
					if (ret.status==true) {
						var html=template('pushAddress',ret);
						$('#showAddress').append(html);
						clickAddress();
						selectAddress();


					}
			})
		}
		getAddress();
		//选择地址
		function clickAddress(){
			$(function() {
					$(".user-addresslist").click(function() {
						$(this).addClass("defaultAddr").siblings().removeClass("defaultAddr");
					});
					$(".logistics").each(function() {
						var i = $(this);
						var p = i.find("ul>li");
						p.click(function() {
							if (!!$(this).hasClass("selected")) {
								$(this).removeClass("selected");
							} else {
								$(this).addClass("selected").siblings("li").removeClass("selected");
							}
						})
					})
				});
		}
		clickAddress();
		//选取收货信息
		function selectAddress(){
			$('#showAddress').find('.user-addresslist').each(function(){
				$(this).click(function(){
					var street=$('#showAddress').find('.defaultAddr').find('.street').html();

					$('.pay-address').find('.street').html('');
					$('.pay-address').find('.street').html(street);

					var province=$('#showAddress').find('.defaultAddr').find('.province').html();
					$('.pay-address').find('.province').html('');
					$('.pay-address').find('.province').html(province);
					var city=$('#showAddress').find('.defaultAddr').find('.city').html();
					$('.pay-address').find('.city').html('');
					$('.pay-address').find('.city').html(city);

					var dist=$('#showAddress').find('.defaultAddr').find('.dist').html();
					$('.pay-address').find('.dist').html('');
					$('.pay-address').find('.dist').html(dist);

					var user=$('#showAddress').find('.defaultAddr').find('.buy-user').html();
					$('.pay-address').find('.buy-user').html('');
					$('.pay-address').find('.buy-user').html(user);

					var phone=$('#showAddress').find('.defaultAddr').find('.buy-phone').html();
					$('.pay-address').find('.buy-phone').html('');
					$('.pay-address').find('.buy-phone').html(phone);

				})
			})
			
			
		}
		//提交订单
		function pushorder(){
			var idProduct=new Array();
			$('#list').find('.item-title').each(function(){
				var test=$(this).attr('alt');
				idProduct.push(test);
			})
			var logistics=$('.op_express_delivery_hot').find('.selected').html();
			var address=$('#showAddress').find('.defaultAddr').html();
			var pay=$('.pay-list').find('.selected').html();
			if (logistics==null) {alert("请选择物流方式");return}
			if (address==null) {alert("请选择邮寄地址");return}
			if (pay==null){
				//存到定单数据库里
				var status="未付款";
				$.get('/Api/Index/addOrder',{'idProduct':idProduct,'status':status},function(){})
				window.location.href="/Home/Order/index";

			}else{
				var user=$('#showAddress').find('.defaultAddr').find('.buy-user').html();
				var phone=$('#showAddress').find('.defaultAddr').find('.buy-phone').html();
				var province=$('#showAddress').find('.defaultAddr').find('.province').html();
				var city=$('#showAddress').find('.defaultAddr').find('.city').html();
				var street=$('#showAddress').find('.defaultAddr').find('.street').html();
				var dist=$('#showAddress').find('.defaultAddr').find('.dist').html();
				var price=$('#J_ActualFee').html();
				var param="";
				 param=price+";"+user+";"+phone+";"+province+";"+city+";"+street+";"+dist;
				var status="已付款";
				$.get('/Api/Index/addOrder',{'idProduct':idProduct,'status':status},function(){})
				window.location.href="/Home/Success/index?param="+param;
			}

		}
	</script>

</html>